import { defineConfig } from "@ice/app";
import request from "@ice/plugin-request";
import store from "@ice/plugin-store";
import auth from "@ice/plugin-auth";

// The project config, see https://v3.ice.work/docs/guide/basic/config
const minify = process.env.NODE_ENV === "production" ? "swc" : false;
export default defineConfig(() => ({
  ssg: false,
  minify,
  plugins: [request(), store(), auth()],
  compileDependencies: false,
  alias: {
    "@": "./src",
  },
  proxy: {
    "/api": {
      target: "http://0.0.0.0:3003",
      // target: 'http://106.55.6.248:3003',
      changeOrigin: true,
      // pathRewrite: { "^/api": "" },
      onProxyReq: (proxyReq, req) => {
        console.log('\x1b[36m%s\x1b[0m', '🚀 Real Request URL:', `${req.method} ${proxyReq.protocol}//${proxyReq.host}${proxyReq.path}`);
      }
    },
  },
}));
